package com.CloudDream.Item;

import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;

import java.util.List;

public class Potion {

    private ItemStack itemStack;

    public ItemStack get() {
        return itemStack;
    }

    public Potion(Material material, String Displayname, List<String> lore, Color color, boolean effect) {
        ItemStack itemStack = new ItemStack(material, 1, (short) 0);
        PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
        if (Displayname != null) {
            meta.setDisplayName(Displayname);
        }
        if (lore != null) {
            meta.setLore(lore);
        }
        if (effect == true) {
            meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
            meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        }
        meta.addEnchant(Enchantment.LUCK, 1, true);
        meta.setColor(color);
        itemStack.setItemMeta(meta);

        this.itemStack = itemStack;
    }
}
